<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title><spring:message code="label.title" /></title>

<style type="text/css">
body {
	font-family: sans-serif;
}

.data,.data td {
	border-collapse: collapse;
	width: 100%;
	border: 1px solid #aaa;
	margin: 2px;
	padding: 2px;
}

.data th {
	font-weight: bold;
	background-color: #5C82FF;
	color: white;
}
</style>
</head>
<body>

	<h2>
		<spring:message code="label.title" />
	</h2>

	<form:form method="post" action="obterMelhorRota.html" commandName="melhorRota">

		<table>
			<tr>
				<td><spring:message code="label.nome" /></td>
				<td><form:select path="nomeDoMapa" items="${mapas}" multiple="false" itemLabel="nome" itemValue="nome" /></td>
			</tr>
			<tr>
				<td><spring:message code="label.origem" /></td>
				<td><form:input path="pontoDeOrigem" /></td>
			</tr>
			<tr>
				<td><spring:message code="label.destino" /></td>
				<td><form:input path="pontoDeDestino" /></td>
			</tr>
			<tr>
				<td><spring:message code="label.autonomia" /></td>
				<td><form:input path="autonomiaDoCaminhao" /></td>
			</tr>
			<tr>
				<td><spring:message code="label.valorlitro" /></td>
				<td><form:input path="valorDoLitroDoCombustivel" /></td>
			</tr>						
			
			<tr>
				<td colspan="2"> <INPUT type="submit"
					value="<spring:message code="label.obtermelhorrota"/>"/> </td>
			</tr>	
		</table>
	</form:form>
	
		<table class="data">

			<tr>
				<td style="width: 50%;">
				<c:forEach items="${melhorRotaResp.pontosDaMelhorRota}" var="ponto" >
					${ponto} - 
				</c:forEach>
				</td>
				
				<td>${melhorRotaResp.custo}</td>
			</tr>
		</table>

	<table>
		<tr>
			<td>
				<a href="../index.jsp"><spring:message code="label.home" /></a>
			</td>
		</tr>
	</table>

	


</body>
</html>
